﻿using Ln.Fram.SqlSugarCore.Abstractions;
using Ln.Rbac.Domain.Entities;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;

namespace Ln.Rbac.SqlSugarCore.DataSeeds;

public class DictionaryTypeDataSeed : IDataSeedContributor, ITransientDependency
{
	#region 构造函数
	public DictionaryTypeDataSeed(ISqlSugarRepository<DictionaryTypeAggregateRoot> repository) => _repository = repository;
	#endregion

	#region 成员属性
	private ISqlSugarRepository<DictionaryTypeAggregateRoot> _repository;
	#endregion

	#region 自身方法
	public async Task SeedAsync(DataSeedContext context) { if (!await _repository.IsAnyAsync(x => true)) await _repository.InsertManyAsync(GetSeedData()); }

	private List<DictionaryTypeAggregateRoot> GetSeedData()
	{
		List<DictionaryTypeAggregateRoot> entities = new List<DictionaryTypeAggregateRoot>();
		entities.AddRange([
			new() { DictName = "用户性别", DictType = "sys_user_sex", OrderNum = 100, Remark = "用户性别列表", IsDeleted = false, State = true },
			new() { DictName = "菜单状态", DictType = "sys_show_hide", OrderNum = 100, Remark = "菜单状态列表", IsDeleted = false, State = true },
			new() { DictName = "系统开关", DictType = "sys_normal_disable", OrderNum = 100, Remark = "系统开关列表", IsDeleted = false, State = true },
			new() { DictName = "任务状态", DictType = "sys_job_status", OrderNum = 100, Remark = "任务状态列表", IsDeleted = false, State = true },
			new() { DictName = "任务分组", DictType = "sys_job_group", OrderNum = 100, Remark = "任务分组列表", IsDeleted = false, State = true },
			new() { DictName = "系统是否", DictType = "sys_yes_no", OrderNum = 100, Remark = "系统是否列表", IsDeleted = false, State = true },
			new() { DictName = "通知类型", DictType = "sys_notice_type", OrderNum = 100, Remark = "通知类型列表", IsDeleted = false, State = true },
			new() { DictName = "通知状态", DictType = "sys_notice_status", OrderNum = 100, Remark = "通知状态列表", IsDeleted = false, State = true },
			new() { DictName = "操作类型", DictType = "sys_oper_type", OrderNum = 100, Remark = "操作类型列表", IsDeleted = false, State = true },
			new() { DictName = "系统状态", DictType = "sys_common_status", OrderNum = 100, Remark = "登录状态列表", IsDeleted = false, State = true },
		]);
		return entities;
	}
	#endregion
}
